package com.tech.java.generic;

import sun.rmi.transport.ObjectTable;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Description:
 * @Author: zl
 * @Date: 2019/9/25 18:38
 */
public class Test<T> {


    private static Map<String, Class<?>> map = new HashMap<>();

    static {

        map.put("string", String.class);

        map.put("integer", Integer.class);

    }

    @SuppressWarnings("unchecked")

    public <T> Class<T> get(String str) {

        return (Class<T>) map.get(str);

    }


    public List<T> list = new ArrayList<T>();
    private static Class<?> aClass;

    public static void main(String[] args) {
        Test<String> test = new Test<String>();
        test.list.add("hello");

        //System.out.println(test.list);


        Class<?> integer = test.get("integer");
        Class<String> string = test.get("string");
        System.out.println(integer);
    }
}